Repository navigation
test(daemon): make the upload deadline tests deterministic under load - #4813
Conversation
The pipelined and lingering-close cases waited for the server by counting event-loop turns (flushIO, bounded polling loops) or moved the fake clock before the server had committed the state the case depends on. Under Coverage instrumentation the server's filesystem completions run late, so a queued 308 was not yet committed when the clock expired its request, and the polling loops gave up before the answers arrived. The cases now wait on explicit events: the server's own request and response hooks (watchServer), complete HTTP responses parsed from the raw socket and the server FIN (readResponses), the server connection close, the auth hook's own call, and the bytes the single-shot upload accepted before each clock step. No production change.
|
Merged main at #4800 on main fixed two of the same tests in |
Size Report
Startup median (7 runs, lower is better):
|
|
Coverage failed at |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on ef17a42. The verdict and the full list are in the summary comment.
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
This PR is ready at c1cd641. The review found no problems in the code, all checks pass, and there are no conflicts. Not blocking, take or leave each:
The earlier inline thread about reporting a reset or early close instead of waiting 3 s is fixed at this head and can be resolved: #4813 (comment) Not verified here: the tests and the slow-IO probe were not run, so the before/after flake rates are the author's. That the tests still catch regressions was judged by reading the upload ingress dispose, fail and end paths, not by a mutation run. Whether admission serializes the retry at line 162 was not traced. |
Summary
Some upload deadline tests failed in the Coverage job on unrelated PRs (#4722 job 136185562286, #4724 job 136241335534). The cause was in the tests. They waited for the server by counting event-loop turns, or they moved the fake clock before the server had reached the state the case depends on. Under Coverage the server's filesystem completions run late. The product code did not change. No failure showed the server resetting an earlier answer.
Root cause per test (
upload-http-deadline.test.ts):flushIO()and assumed B's 308 was already committed. When B's offsetstatran late, B's inactivity ceiling fired first, so B answered a typed 500. That is correct product behavior. The test now waits for the server to end B's response before it moves the clock.flushIO) waited for two responses. It did not throw when it gave up, so a late rename produced[]. The test now waits for B's admission and for B's committed answer, then for two complete responses parsed from the socket.flushIOwithgetConnections. The test now waits for the parsed response, for the server FIN, and for the server-side connectionclose.transfer_ingress_deadline_exceeded.upload-http-socket-ownership.test.tshad the same turn counting. They now wait on the parsed response, the FIN, the connection close, the hook's own call, and the signal'sabortevent.The new
upload-loopback.fixtures.tsholds the shared event helpers:watchServer(the server's own request/response hooks and connection close),readResponses(complete HTTP responses, FIN and errors from a raw socket), andwatchAcceptedArtifactBytes. No assertion is weaker, and there are no retries or new sleeps.Validation
Head
32677009f7.pnpm check:affected --runpassed with exactCommit=true (format, lint, typecheck, layering, fallow, vitest-related).Reproduction: a probe that is not committed (
NODE_OPTIONS=--import slow-io.mjs) adds a real-time delay afterfs.promisescompletions. It reproduces each CI failure with the same assertion:The CPU-load runs had a low base rate: a second 100-run batch on main passed 100/100. That is why the probe is the reliable reproduction.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.